package com.niuyubo;

import com.common.lambda.Animal;

public class LambdaTest {
    public static void main(String[] args) {
        method1();
        method2();
        method3();
        method4();
    }

    static void method1() {
        Dog dog = new Dog();
        dog.info();
    }

    static void method2() {
        Animal animal = new Animal() {
            @Override
            public void info() {
                System.out.println("This is a dog");
            }
        };
        animal.info();
    }


    static void method3() {
        Animal animal = () -> {System.out.println("This is a dog");};
        animal.info();
    }


    static void method4() {
        Animal animal = () -> System.out.println("This is a dog");
        animal.info();
    }




}

class Dog implements Animal{
    @Override
    public void info() {
        System.out.println("This is a dog");
    }
}
